package com.service.business.member.service;

import com.service.business.pay.dto.PayOrder;
import com.service.dao.enums.CoinsEnum;
import com.service.dao.enums.MemberJAType;
import com.service.dao.model.Member;
import com.service.dao.model.MemberGradeConfig;
import com.service.dao.model.RecommendAwardConfig;
import com.service.dao.po.MemberCache;

import java.math.BigDecimal;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

/**
 * <dl>
 * <dt>back-end</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * <dd>Company: </dd>
 * <dd>CreateDate: 2019年12月27日</dd>
 * </dl>
 *
 * @author
 */
public interface MemberAwardService {

    /**
     * 支付礼包商品订单处理
     */
    void dealMemberPayGiftBagOrder(PayOrder payOrder);

    MemberCache calculateMemberCache(Integer memberId, BigDecimal payMoney, Map<String, String> configMap);

    void addMember2ParentMemberValidDirectList(Member member, MemberCache payMemberCache);

    void calculateRecommendAward(Member member, Map<String, String> configMap, PayOrder payOrder, CoinsEnum coins);

    BigDecimal calculateMemberAward(MemberCache memberCache, PayOrder payOrder, RecommendAwardConfig config,
                                    MemberJAType jaType, BigDecimal multiple, CoinsEnum coins, String remark,
                                    Map<String, String> sysConfig);

    void calculateCommunityAndNodeAward(Member member, Map<String, String> configMap, PayOrder payOrder, CoinsEnum coins);

    BigDecimal calculateCommunityAward(MemberCache memberCache, MemberGradeConfig gradeConfig, Member payMember, CoinsEnum coins,
                                       PayOrder payOrder, AtomicReference<MemberGradeConfig> lastAwardGrade,
                                       BigDecimal residueAwardLimit);

    void calculateNodeAward(MemberCache memberCache, MemberGradeConfig gradeConfig, Member payMember,
                            CoinsEnum coins, PayOrder payOrder, AtomicReference<BigDecimal> firstLeaderAward,
                            AtomicReference<BigDecimal> lastAward, AtomicReference<BigDecimal> leaderAwardRate,
                            BigDecimal residueAwardLimit);
}
